﻿using System.Diagnostics;

namespace DimensionsHelper.LanguageService.Syntax;

public class BooleanLiteral : Literal<bool>
{
    internal BooleanLiteral(SyntaxNode? parent) : base(SyntaxKinds.Boolean, false, parent)
    {
    }
}


public static partial class NodeFactory
{
    public static BooleanLiteral CreateBooleanLiteral(SyntaxNode? parent, bool value)
    {
        return new BooleanLiteral(parent) { Value = value };
    }


    public static BooleanLiteral CreateBooleanLiteral(SourceNode source)
    {
        Debug.Assert(source.IsOneOfNode(SyntaxKinds.TrueKeywordToken, SyntaxKinds.FalseKeywordToken));
        BooleanLiteral literal = CreateBooleanLiteral(null, source.TokenBooleanValue);
        literal.UpdateFrom(source);
        return literal;
    }
}